package com.zuqiuzhandui.liveing.view.chooseSchedule;

import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zuqiuzhandui.R;
import com.zuqiuzhandui.liveing.base.BaseActivity;
import com.zuqiuzhandui.liveing.model.resultModel.TeamScheduleRs;


import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class ChooseScheduleActivity extends BaseActivity {

    @BindView(R.id.rv_main)
    RecyclerView rvMain;
    ScheduleAdapter mAdapter;
    Intent intent;


    private ArrayList<TeamScheduleRs> data;

    @Override
    public void setViewId() {
        setContentView(R.layout.activity_choose_schedule);
    }

    @Override
    public void initView() {
            rvMain.setLayoutManager(new LinearLayoutManager(this));
            intent = getIntent();
    }

    @Override
    public void initData() {

    }

    @Override
    public void setMonter() {
       mAdapter.setOnRecyclerViewItemClickListener(new BaseQuickAdapter.OnRecyclerViewItemClickListener() {
           @Override
           public void onItemClick(View view, int i) {
               Intent intent=new Intent();
               Bundle bundle=new Bundle();
               bundle.putInt("index",i);
               intent.putExtra(BUNDLE_KEY,bundle);
               setResult(RESULT_OK,intent);
               finish();
           }
       });
    }

    @Override
    public void getBundle() {
        Bundle bundleExtra = getIntent().getBundleExtra(BUNDLE_KEY);
        ArrayList<TeamScheduleRs> schedule = (ArrayList<TeamScheduleRs>) bundleExtra.getSerializable("schedule");
        mAdapter=new ScheduleAdapter(schedule);
        rvMain.setAdapter(mAdapter);
    }
}
